<template>
  <div class="dashboard">
    <panel-group @setLineChartData="changeChartData" :panellist="panelList"></panel-group>
    <line-chart :chartdata="lineChartDataList" />
    <charts-list class="charts-list"></charts-list>

  </div>
</template>
<script>
import echarts from 'echarts'
const lineChartDatas = [
  {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  },
  {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }]

import panelGroup from './panelgroup.vue'
import lineChart from './linechart.vue'
import chartsList from './chartslist.vue'
export default {
  components:{
    panelGroup,
    lineChart,
    chartsList
  },
  data() {
    return {
      lineChartDataList:lineChartDatas,
      panelList:[{name:'a111',sum:111,img:'a.jpg',staimg:'a.jpg',actimg:'a.jpg',select:true},{name:'a111',sum:111,img:'b.jpg',staimg:'b.jpg',actimg:'c.jpg',select:true},
      {name:'a111',sum:111,img:'a.jpg',staimg:'a.jpg',actimg:'c.jpg',select:true},{name:'a111',sum:111,img:'b.jpg',staimg:'b.jpg',actimg:'c.jpg',select:true}]
    }
  },
  methods: {
    changeChartData(param){
      console.log(param,'param');
      let newlineChartDatas=[]
      param.forEach(v => {
        newlineChartDatas.push(lineChartDatas[v])
      });
      this.lineChartDataList=newlineChartDatas
      console.log(this.lineChartDataList,'this.lineChartDataList');
      
      // this.lineChartData=lineChartDatas[param]
    }
  },
}
</script>
<style lang="less" scoped>
  .dashboard {
    padding: 10px 20px;
    box-sizing: border-box;
    background: #cccccc;
    width: 100%;
    // position: relative;
    height: 1000px;
    .charts-list {
      width: 100%;
      height: 400px;
      margin-top: 20px;
    }
  }
</style>
